package com.zyy.zyy.controller;

import com.zyy.zyy.dataobject.*;
import com.zyy.zyy.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/index")
public class IndexController {

    @Resource
    IndexService indexService;

    @PostMapping("selectIndexData")
    public @ResponseBody Object selectIndexData(){
        List<DataDO> newsData = indexService.selectIndexNews();
        List<DataDO> noticeData = indexService.selectIndexNotice();
        List<DataDO> policyData = indexService.selectIndexPolicy();
        List<DataDO> guideData = indexService.selectIndexGuide();

        List<Hosp> hospitalData = indexService.selectIndexHosp();
        List<Specialty> specialtyData=indexService.selectIndexSpecialty();
        List<ChineseMedicine> doctorData = indexService.selectIndexDoctor();

        List<Map<String, Integer>> developTecSerOrgDOList = indexService.selectIndexDevelopTecSerOrgDOList();

        List<IndustrialDevelopSciAchiDO> industrialDevelopSciAchiDOList = indexService.selectIndexIndustrialDevelopSci();
        List<IndustrialDevelopCooExcDO> industrialDevelopCooExcDOList = indexService.selectIndexindustrialDevelopCooExcDO();
        List<IndustrialDevelopTalRecDOWithBLOBs> industrialDevelopTalRecDOList = indexService.selectIndexIndustrialDevelopTalRecDO();

        HashMap<String,Object> allData=new HashMap<>();
        allData.put("news",newsData);
        allData.put("notice",noticeData);
        allData.put("policy",policyData);
        allData.put("guide",guideData);
        allData.put("hospital",hospitalData);
        allData.put("specialty",specialtyData);
        allData.put("doctor",doctorData);
        allData.put("developTecSerOrgDOList",developTecSerOrgDOList);
        allData.put("industrialDevelopSciAchiDOList",industrialDevelopSciAchiDOList);
        allData.put("industrialDevelopCooExcDOList",industrialDevelopCooExcDOList);
        allData.put("industrialDevelopTalRecDOList",industrialDevelopTalRecDOList);

        return allData;
    }


}
